feat: heuristic 6-stakeholder SWOT analysis replacing mechanical document classification#1155
Merged
feat: heuristic 6-stakeholder SWOT analysis replacing mechanical document classification#1155
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the legacy 3-stakeholder document-title-truncation SWOT generator with a heuristic rules-based 6-stakeholder analyzer that produces entries with justification, trend direction, quantitative evidence, cross-references, and confidence scoring.
New:
ai-swot-analyzer.tsimpact,justification,trendDirection,relatedDocuments,quantitativeEvidenceSTAKEHOLDER_NAMES,STAKEHOLDER_ROLES,CONTEXT_LABELSlocalized across all 14 languages asReadonly<Record<Language, string>>with English fallbacksEnhanced renderer (
stakeholder-swot-section.ts)aria-labelfallback whenlbl()returns the key itself<details>sectionsswotJustification,swotTrendImproving/Stable/Deteriorating,swotEvidenceGenerator refactor (
generators.ts)effectiveType()classification viaMap<string, RiksdagenDoc[]>replaces ~9 separatefilter()passes'fpm' || 'eu'(restoring dual-type handling)?? STAKEHOLDER_NAMES[p].en ?? pdefensive fallbackCSS & i18n
styles/components/swot.cssfor.swot-trend,.swot-justification,.swot-evidenceOriginal prompt
This section details on the original issue you should resolve
<issue_title>📊 Enhanced Stakeholder SWOT Analysis with AI-Generated Multi-Perspective Intelligence</issue_title>
<issue_description>## 📋 Issue Type
Feature / Architecture Enhancement
🎯 Objective
Redesign the SWOT analysis generators (
swot-section.ts,stakeholder-swot-section.ts) to produce AI-driven, multi-perspective political intelligence instead of document-metadata-derived entries. Expand stakeholder perspectives from 3 to 6+, and ensure all SWOT content is generated through AI reasoning rather than mechanical document classification.📊 Current State
buildDeepInspectionSections()ingenerators.ts(lines 1102-1253) classifies documents mechanically:titleOf(d).slice(0, 80))SWOT_DEFAULTSare static translations, not contextual analysisstakeholder-swot-section.tsrenders data but doesn't analyze it🚀 Desired State
Expanded Stakeholder Perspectives (6+)
AI-Generated SWOT Content
Each SWOT entry must be:
Architecture Changes
scripts/data-transformers/content-generators/ai-swot-analyzer.ts:stakeholder-swot-section.tsto render enhanced SWOT cards with:SWOT_DEFAULTSfromgenerators.ts🔧 Implementation Approach
StakeholderPerspectivetype with 6+ perspectives🤖 Recommended Agent
code-quality-engineer — Refactoring SWOT generation from template-based to AI-driven
✅ Acceptance Criteria
SWOT_DEFAULTSfallback strings remain📚 References
scripts/data-transformers/content-generators/swot-section.tsscripts/data-transformers/content-generators/stakeholder-swot-section.tsscripts/generate-news-enhanced/generators.ts:1102-1253🏷️ Labels
`typ...
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.